<template>
	<HyCard title="基本信息">
		<el-descriptions :column="3" border>
			<el-descriptions-item label="会议名称" span="3">{{ props.basicData.meetingName }}</el-descriptions-item>
			<el-descriptions-item label="评审时间">{{ props.basicData.reviewTime }}</el-descriptions-item>
			<el-descriptions-item label="预计评审耗时">{{ props.basicData.estimatedReviewTime }}小时</el-descriptions-item>
			<el-descriptions-item label="评委到场时间">{{ props.basicData.arrivalTime }}</el-descriptions-item>
			<el-descriptions-item label="评审地点">{{ props.basicData.reviewAddress }}</el-descriptions-item>
			<el-descriptions-item label="联系人">{{ props.basicData.contactPerson }}</el-descriptions-item>
			<el-descriptions-item label="联系方式">{{ props.basicData.contactInformation }}</el-descriptions-item>
		</el-descriptions>
	</HyCard>
	<div class="mt-5"></div>
	<HyCard title="抽取设置">
		<el-descriptions :column="3" border>
			<el-descriptions-item label="管理类专家人数">{{ props.expertWayData.expertManagerCount }}人</el-descriptions-item>
			<el-descriptions-item label="技术类专家人数">{{ props.expertWayData.expertTechnologyCount }}人</el-descriptions-item>
			<el-descriptions-item label="所需行业领域">{{ changeArray(props.expertWayData.expertIndustryFieldsName) }}</el-descriptions-item>
			<el-descriptions-item label="所需专业领域">{{ changeArray(props.expertWayData.expertProfessionalFieldsName) }}</el-descriptions-item>
			<el-descriptions-item span="3" label="回避单位">{{ changeArray(props.expertWayData.expertAvoidanceUnits) }}</el-descriptions-item>
			<el-descriptions-item span="3" label="回避专家">
				<ExpertTable title="回避专家" :routerParams="routerParams" ref="expertTableRef1" />
			</el-descriptions-item>
		</el-descriptions>
		<div class="mt-5">
			<el-alert
				:closable="false"
				type="success"
				:description="`本次项目回避单位${
					props.expertWayData.expertAvoidanceUnits && props.expertWayData.expertAvoidanceUnits?.length > 0
						? props.expertWayData.expertAvoidanceUnits
						: 0
				}家，回避专家${props.expertAvoidanceData && props.expertAvoidanceData.length > 0 ? props.expertAvoidanceData : 0}人`"
			/>
		</div>
	</HyCard>
	<div class="mt-5"></div>
	<HyCard title="抽取结果">
		<el-descriptions :column="3" border>
			<el-descriptions-item label="抽取状态">{{ props.extractResultData.extractStatusName }}</el-descriptions-item>
			<el-descriptions-item label="抽取结果">{{ props.extractResultData.extractResult }}</el-descriptions-item>
			<el-descriptions-item label="结果说明">{{ props.extractResultData.extractResultRemark }}</el-descriptions-item>
			<el-descriptions-item label="抽取时间">{{ props.extractResultData.extractTime }}</el-descriptions-item>
		</el-descriptions>
	</HyCard>
	<div class="mt-5"></div>
	<HyCard>
		<el-tabs v-model="activeName" @tab-click="handleClick">
			<el-tab-pane style="overflow-x: auto" label="评审应用" name="1">
				<AppTable ref="appTableRef" :routerParams="props.routerParams" />
			</el-tab-pane>
			<el-tab-pane v-if="props.expertListData.length > 0" style="overflow-x: auto" label="评审专家" name="2">
				<ExpertTable title="更换专家" @handleRefresh="handleRefresh" ref="expertTableRef2" :routerParams="props.routerParams" />
			</el-tab-pane>
			<el-tab-pane v-if="props.institutionListData.length > 0" style="overflow-x: auto" label="评审机构" name="3">
				<InstitutionTable @handleRefresh="handleRefresh" ref="institutionRef" :routerParams="props.routerParams" />
			</el-tab-pane>
		</el-tabs>
	</HyCard>
</template>
<script setup lang="ts">
import HyCard from '/@/components/HyCard/index.vue';
import ExpertTable from '../ExpertTable/index.vue';
import AppTable from '../AppTable/index.vue';
import InstitutionTable from '../InstitutionTable/index.vue';

const props = defineProps({
	basicData: {
		default: () => ({}),
		type: Object,
	},
	extractResultData: {
		default: () => ({}),
		type: Object,
	},
	expertWayData: {
		default: () => ({}),
		type: Object,
	},
	expertiseData: {
		default: () => ({}),
		type: Object,
	},
	expertAvoidanceData: {
		default: () => [],
		type: Array,
	},
	routerParams: {
		type: Object,
		default: () => {
			return {};
		},
	},
	expertSpecifiedData: {
		type: Array,
		default: () => {
			return [];
		},
	},
	expertListData: {
		type: Array,
		default: () => {
			return [];
		},
	},
	reviewAppData: {
		type: Array,
		default: () => {
			return [];
		},
	},
	institutionListData: {
		type: Array,
		default: () => {
			return [];
		},
	},
});
const appTableRef = ref();
watch(
	() => props.reviewAppData,
	(nv1: any) => {
		if (nv1 && nv1.length > 0) {
			nextTick(() => {
				appTableRef.value.tableData = nv1;
			});
		}
	},
	{ immediate: true }
);
const expertTableRef1 = ref();
watch(
	() => props.expertSpecifiedData,
	(nv1: any) => {
		if (nv1 && nv1.length > 0) {
			nextTick(() => {
				expertTableRef1.value.tableData = nv1;
			});
		}
	},
	{ immediate: true }
);
const expertTableRef2 = ref();
watch(
	() => props.expertListData,
	(nv1: any) => {
		if (nv1 && nv1.length > 0) {
			nextTick(() => {
				expertTableRef2.value.tableData = nv1;
			});
		}
	},
	{ immediate: true }
);
const institutionRef = ref();
watch(
	() => props.institutionListData,
	(nv1: any) => {
		if (nv1 && nv1.length > 0) {
			nextTick(() => {
				institutionRef.value.tableData = nv1;
			});
		}
	},
	{ immediate: true }
);
watch(
	() => props.extractResultData,
	(nv1: any) => {
		if (nv1 && nv1.length > 0) {
			nextTick(() => {
				institutionRef.value.tableData = nv1;
			});
		}
	},
	{ immediate: true }
);
const changeArray = (array: any) => {
	if (array && array.length > 0) {
		return array.join(',');
	} else {
		return '';
	}
};
const handleClick = () => {};
const activeName = ref('1');
//刷新
const emits = defineEmits(['handleRefresh']);
const handleRefresh = () => {
	emits('handleRefresh');
};
</script>
<style scoped lang="scss">
:deep(.el-descriptions__label) {
	width: 10% !important;
}
</style>
